{template 'public/header'}
{template 'public/comhead'}
<style type="text/css">
    .nav-tabs{
        margin-top: 30px;
    }
    .nav-tabs>li>a:hover{
        color: #333;
        border-color: #31C2A5;
        background-color: white;
    }
    .nav-tabs > li.active > a,.nav-tabs > li.active > a:hover{
        background-color: #31C2A5;
        color: white;
        border-color: #31C2A5;
    }
    .nav.nav-tabs{border-color: #31C2A5;}
    .yg5_key>div{float: left;line-height: 34px;}
    .store_td1{height: 45px;}
    .store_list_img{width: 60px;height: 60px;}
    .yg5_tabel{border-color: #e5e5e5;outline: 1px solid #e5e5e5;}
    .yg5_tr2>td{padding: 15px;border: 1px solid #e5e5e5;text-align: center;}
    .yg5_tr1>td{
        border: 1px solid #e5e5e5;
        padding-left: 15px;
        background-color: #FAFAFA;
        font-weight: bold;
        text-align: center;
    }
    .yg5_btn{background-color: #EEEEEE;color: #333;border: 1px solid #E4E4E4;border-radius: 6px;width: 100px;height: 34px;}
</style>
<ul class="nav nav-tabs">    
    <li class="active"><a href="{php echo $this->createWebUrl('yellowtype2')}">二级信息分类管理</a></li>
    <li><a href="{php echo $this->createWebUrl('addyellowtype2')}">添加二级信息分类</a></li>
</ul>
<div class="main">
    <div class="panel panel-default">
        <div class="panel-body">
            <a class="btn btn-primary" href="javascript:location.reload()"><i class="fa fa-refresh"></i>刷新</a>
             <input class="btn btn-default btn-danger" name="allselect" value="批量删除">
        </div>
    </div>
    <!-- 门店列表部分开始 -->
        <div class="panel panel-default">
            <div class="panel-heading">
               信息分类
            </div>
            <div class="panel-body" style="padding: 0px 15px;">
                <div class="row">
                    <table class="yg5_tabel col-md-12">
                        <tr class="yg5_tr1">
                         <th class="store_td1 col-md-1">
                      <input type="checkbox" class="allcheck" />
                      <span class="store_inp">全选</span>
                  </th>
                            <td class="store_td1 col-md-1">顺序</td>
                            <td class="col-md-2">二级信息分类名称</td>
                            <td class="col-md-2">所属信息分类</td>
                              <td class="col-md-2">状态</td>
<!--                             <td class="col-md-2">价格</td> -->
                            <td class="col-md-3">操作</td>
                        </tr>
                        {loop $list $row}
                        <tr class="yg5_tr2">
                         <td>
                      <input type="checkbox" name="test" value="{$row['id']}">
                      <span class="store_inp">选择</span>
                  </td>
                            <td><div>{$row['num']}</div></td>
                            <td>{$row['name']}</td>
                            <td>{$row['type_name']}</td>
<!--                              <td>{$row['money']}</td> -->
  <td>{if $row['state']==1} <span class="label label-info">启用</span>{elseif $row['state']==2} <span class="label label-danger">禁用</span>{/if}</td>
                            <td><a class="btn btn-warning btn-sm" href="{php echo $this->createWebUrl('addyellowtype2', array('id' => $row['id']))}" title="编辑">改</a>&nbsp;&nbsp;
                           <button type="button" class="btn btn-danger btn-sm" data-toggle="modal" data-target="#myModal{$row['id']}">删</button>
                            </td>
                        </tr>
                         <div class="modal fade" id="myModal{$row['id']}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                      <div class="modal-dialog" role="document">
                        <div class="modal-content">
                          <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title" id="myModalLabel" style="font-size: 20px;">提示</h4>
                        </div>
                        <div class="modal-body" style="font-size: 20px">
                            确定删除么？
                        </div>
                        <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                            <a href="{php echo $this->createWebUrl('yellowtype2', array('id' => $row['id']))}" type="button" class="btn btn-info" >确定</a>
                        </div>
                    </div>
                </div>
            </div>
                        {/loop}
                       
                    </table>
                </div>
            </div>
        </div>
    {$pager}
</div>
<script type="text/javascript">
    $(function(){
        $("#frame-4").show();
        $("#yframe-4").addClass("wyactive");
        $("input[name=allselect]").on('click',function(){
            var check = $("input[type=checkbox][class!=allcheck]:checked");
            if(check.length < 1){
                alert('请选择要删除的用户!');
                return false;
            }else if(confirm("确认要删除此用户?")){
                var id = new Array();
                check.each(function(i){
                    id[i] = $(this).val();
                });
                console.log(id)
                $.ajax({
                    type:"post",
                    url:"{$_W['siteroot']}/app/index.php?i={$_W['uniacid']}&c=entry&do=alldelete&m=zh_tcwq",
                    dataType:"text",
                    data:{id:id},
                    success:function(data){
                        console.log(data);      
                       location.reload();
                    }
                })
               
            }
        });
        $(".allcheck").on('click',function(){
            var checked = $(this).get(0).checked;
            $("input[type=checkbox]").prop("checked",checked);
        });
        
    })
</script>
<!-- {template 'common/footer'} -->